package cn.calm.entity;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import cn.calm.commons.entity.BaseEntity;


/**
 * The persistent class for the t_button database table.
 * 
 */
@Entity
@Table(name="button")
public class Button implements BaseEntity {
	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private ButtonPK id;

	private String description;

	private String func;

	//bi-directional many-to-one association to Dialog
    @ManyToOne(optional=false)
	@JoinColumn(name="dialog_id",nullable=false,updatable=false,insertable=false)
	private Dialog dialog;

    public Button() {
    }

	public ButtonPK getId() {
		return this.id;
	}

	public void setId(ButtonPK id) {
		this.id = id;
	}
	
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getFunc() {
		return this.func;
	}

	public void setFunc(String func) {
		this.func = func;
	}

	public Dialog getDialog() {
		return this.dialog;
	}

	public void setDialog(Dialog dialog) {
		this.dialog = dialog;
		if(id==null){
			id=new ButtonPK();
		}
		id.setDialogId(dialog.getId());
	}
	
	@Override
	public Object getValue() {
		return id;
	}

	@Override
	public String getDisplayName() {
		return "按钮";
	}
	
}